<?php
require_once(dirname(__FILE__)."/config.php");
require_once(DEDEMEMBER . '/lib_sms.php');
//开启SESSION
session_start();

header("Content-type:text/html; charset=UTF-8");

$vacode=rand('111111','999999');
PutCookie('mobile_vcode', $vacode, 60*6, '/');
$message="您的验证码是：".$vacode."。请不要把验证码泄露给其他人。";
$row = $dsql->GetOne("SELECT * FROM `#@__sysconfig` WHERE varname='cfg_smsbao_name' ");
$row_pwd = $dsql->GetOne("SELECT * FROM `#@__sysconfig` WHERE varname='cfg_smsbao_password' ");
$row_sign = $dsql->GetOne("SELECT * FROM `#@__sysconfig` WHERE varname='cfg_smsbao_sign' ");	
$infos=$row['value'].','.$row_pwd['value'].','.$row_sign['value'].','.$_POST['mobile_phone'];
$result = sendsms($infos, $message);

$yanzhengma = md5($vacode);
if($result=='0'){
	//echo '验证码已发送，请注意查收';
	$arr = array(
       "zhi"=>"ok",
       "yzm"=>$yanzhengma,
       "msg"=>"验证码已发送，请注意查收"
    );
    echo json_encode($arr);
    exit;
}else{
	//echo '验证码发送失败，请重试，错误代码：'.$result;
	$arr = array(
       "zhi"=>"ok",
       "yzm"=>$yanzhengma,
       "msg"=>"验证码发送失败，请重试，错误代码：'.$result"
    );
}

?>